$(document).ready((function() {
      //$("input[type='submit']").prop("disabled", true); // disable the submit button
	$("#addClient").submit(function(){
      $("input.username").on('keyup change blur', function (event) {
    	  $.ajax({
    		  url: 'addClient',
    		  type: "GET",
    		  dataType: 'json', 
    		  data: $('#addClient').serialize(),
    		  success: function(data) {
    			  if(data.isValid) {
    				  $("input[type='submit']").prop("disabled", false);
    			  }
    			  else {
    				  alert("please insert data");
    				  //tutaj wywalic wszystkie dziwne rzeczy
    			  }
    		  }
    	  });
    	  return false;
      
      
      });
      
      
      
      
      
  /*    
      $("input.phone_number").formance("format_phone_number") // setup the formatter
                             .on( 'keyup change blur', function (event) { // setup the event listeners to validate the field whenever the user takes an action
                               if ( $(this).formance('validate_phone_number') )
                                 $("input[type='submit']").prop("disabled", false); // enable the submit button if valid phone number
                               else
                                 $("input[type='submit']").prop("disabled", true); // disable the submit button if invalid phone number
                             });*/
    });
}